home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / PowerPC / Dev / PPCRelease / Examples / R.Mainz / fastprim / runprim.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-28  |  2.3 KB  |  84 lines

  1.  
  2. /* amiga includes */
  3. #include <exec/memory.h>
  4. #include <dos/dostags.h>
  5. #include <workbench/startup.h>
  6. #include <workbench/workbench.h>
  7. #include <workbench/icon.h>
  8.  
  9. /* amiga prototypes */
  10. #include <clib/dos_protos.h>
  11. #include <clib/exec_protos.h>
  12.  
  13. /* amiga pragmas */
  14. #include <pragmas/dos_pragmas.h>
  15. #include <pragmas/exec_pragmas.h>
  16.  
  17. /* PowerUP stuff */
  18. #include <PowerUP/PPCLib/Interface.h>
  19. #include <PowerUP/PPCLib/tasks.h>
  20. #include <PowerUP/PPCLib/ppc.h>
  21. #include <PowerUP/PPCLib/object.h>
  22. #include <PowerUP/PPCDisslib/PPCDiss.h>
  23. #include <PowerUP/clib/ppc_protos.h>
  24. #include <PowerUP/clib/ppcdiss_protos.h>
  25. #include <PowerUP/pragmas/ppcdiss_pragmas.h>
  26. #include <PowerUP/pragmas/ppc_pragmas.h>
  27.  
  28. /* ANSI includes */
  29. #include <stdlib.h>
  30.  
  31.  
  32. extern struct Library *SysBase,
  33.                       *DOSBase;
  34.        struct Library *PPCLibBase;
  35.  
  36.  
  37. int main( void )
  38. {
  39.     if( PPCLibBase = OpenLibrary( "ppc.library", 45UL ) )
  40.     {
  41.       APTR ELFObject;
  42.  
  43.       extern char   elfobject[];
  44.       extern size_t elfobject_size;
  45.  
  46.       if( ELFObject = PPCLoadObjectTags( PPCELFLOADTAG_ELFADDRESS, (ULONG)elfobject,
  47.                                          PPCELFLOADTAG_ELFLENGTH,  (ULONG)elfobject_size,
  48.                                          TAG_DONE ) )
  49.       {
  50.         struct TagItem MyTags[ 9 ];
  51.         ULONG          Result;
  52.  
  53.         MyTags[ 0 ] . ti_Tag  = PPCTASKTAG_STOPTASK;
  54.         MyTags[ 0 ] . ti_Data = FALSE;
  55.         MyTags[ 1 ] . ti_Tag  = PPCTASKTAG_WAITFINISH;
  56.         MyTags[ 1 ] . ti_Data = TRUE;
  57.         MyTags[ 2 ] . ti_Tag  = PPCTASKTAG_INPUTHANDLE;
  58.         MyTags[ 2 ] . ti_Data = (ULONG) Input();
  59.         MyTags[ 3 ] . ti_Tag  = PPCTASKTAG_OUTPUTHANDLE;
  60.         MyTags[ 3 ] . ti_Data = (ULONG) Output();
  61.         MyTags[ 4 ] . ti_Tag  = PPCTASKTAG_STACKSIZE;
  62.         MyTags[ 4 ] . ti_Data = 0x10000;
  63.         MyTags[ 5 ] . ti_Tag  = NP_CloseInput;
  64.         MyTags[ 5 ] . ti_Data = FALSE;
  65.         MyTags[ 6 ] . ti_Tag  = NP_CloseOutput;
  66.         MyTags[ 6 ] . ti_Data = FALSE;
  67.         MyTags[ 7 ] . ti_Tag  = PPCTASKTAG_BREAKSIGNAL;
  68.         MyTags[ 7 ] . ti_Data = TRUE;
  69.         MyTags[ 8 ] . ti_Tag  = TAG_DONE;
  70.         MyTags[ 8 ] . ti_Data = 0UL;
  71.  
  72.         Result = (ULONG)PPCCreateTask( ELFObject, &MyTags[ 0 ] );
  73.  
  74.         PPCUnLoadObject( ELFObject );
  75.       }
  76.  
  77.       CloseLibrary( PPCLibBase );
  78.     }
  79.     
  80.     return( RETURN_OK );
  81. }
  82.  
  83.  
  84.